package com.ruoyi.project.storage.controller;

import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.storage.domain.vo.AdviceVO;
import com.ruoyi.project.storage.service.IAdviceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 手机端意见添加controller
 *
 * @author mengyuanqing
 * @date 2020/5/1
 */
@RestController
@RequestMapping("/app/personal")
@Api(tags = {"【手机端】5.2.8 意见建议"},description = "编写意见建议")
public class AppAdviceController extends BaseController {
    /**
     * 建议service
     */
    private final IAdviceService adviceService;

    /**
     * 通过构造方法的方式注入建议service
     *
     * @param adviceService 建议service
     */
    public AppAdviceController(IAdviceService adviceService)
    { this.adviceService = adviceService; }

    /**
     * 新增建议
     */
    @Log(title = "5.2.8.1 意见新增", businessType = BusinessType.INSERT)
    @PostMapping("/advice")
    @ApiOperation(value = "5.2.8.1 意见新增", notes = "新增意见")
    public AjaxResult add(@RequestBody AdviceVO adviceVO) {
        //返回响应结果
        return toAjax(adviceService.insertAdvice(adviceVO));
    }
}
